package com.hgyc.mom.qms.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hgyc.mom.common.vo.Result;
import com.hgyc.mom.core.mybatis.QueryWrapperUtil;
import com.hgyc.mom.qms.entity.QmsIqcDetail;
import com.hgyc.mom.qms.service.QmsIqcDetailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 来料检验项明细Controller
 *
 * @author fwj
 * @since 2025-09-27
 */
@Tag(name = "来料检验项明细控制器", description = "来料检验项明细控制器")
@RestController
@RequestMapping("/qms/iqc/detail")
public class QmsIqcDetailController {
    @Autowired
    private QmsIqcDetailService qmsIqcDetailService;


    @Operation(summary = "查询来料检验项明细树列表", description = "查询来料检验项明细树列表")
    @PostMapping("/list")
    public Result<List<QmsIqcDetail>> pageList(@Parameter(description = "查询参数") @RequestBody QmsIqcDetail qmsIqcDetail) {
        QueryWrapper<QmsIqcDetail> wrapper = QueryWrapperUtil.build(qmsIqcDetail);
        List<QmsIqcDetail> list = qmsIqcDetailService.list(wrapper);
        return Result.success(list);
    }

    @Operation(summary = "获取来料检验项明细详细信息", description = "获取来料检验项明细详细信息")
    @GetMapping(value = "/{id}")
    public Result<QmsIqcDetail> getInfo(@Parameter(description = "来料检验项明细ID") @PathVariable("id") Long id) {
        return Result.success(qmsIqcDetailService.getById(id));
    }

}
